<template>
  <div>
    <h2>我是首页</h2>
    <button @click="add_num(10)">+</button>
    {{ num }}
    <button @click="reduce_num(5)">-</button>
    <button @click="add_num_async(50)">异步+</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  methods: {
    ...mapMutations(['add_num', 'reduce_num']),
    ...mapActions(['add_num_async'])
  },
  mounted () {
    console.log(this)
  },
  computed: {
    ...mapState(['num'])
  }
}
</script>

<style lang="scss" scoped>

</style>
